{extend name="base" /} {block name="body"}
<div class="layui-body">
	<!--tab标签-->
	<div class="layui-tab layui-tab-brief">
		<ul class="layui-tab-title">
			<li class="">
				<a href="{:url('prize/index')}">奖品管理</a>
			</li>
			<li class="layui-this">添加奖品</li>
		</ul>
		<div class="layui-tab-content">
			<div class="layui-tab-item layui-show">
				<form class="layui-form form-container" action="{:url('prize/save')}" method="post">
					<div class="layui-form-item">
						<label class="layui-form-label">奖品名称</label>
						<div class="layui-input-block">
							<input type="text" name="name" value="" required lay-verify="required" placeholder="请输入奖品名称" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">奖品图片</label>
						<div class="layui-input-block" style="padding-left: 10px;">
							<div class="layui-upload">
								<button type="button" class="layui-btn" id="image">上传图片</button>
								<div class="layui-upload-list">
									<img class="layui-upload-img" style="width: 150px;height: 150px;" id="demo1">
									<p id="demoText"></p>
								</div>
							</div>
						</div>
						<input type="hidden" name="thumb" id="thumb"/>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">奖品数量</label>
						<div class="layui-input-block">
							<input type="text" name="num" value="" required lay-verify="required" placeholder="请输入奖品数量" class="layui-input">
						</div>
					</div>
				  	<div class="layui-form-item">
					    <label class="layui-form-label">需求矿石</label>
					    <div class="layui-input-block">
					    	{volist name="ks_list" id="vo"}
								<input type="checkbox" name="demand[{$vo.id}]" value="{$vo.id}" title="{$vo.name}">
							{/volist}
					    </div>
				  	</div>
			  		<div class="layui-form-item layui-form-text">
					    <label class="layui-form-label">说明</label>
					    <div class="layui-input-block">
					      <textarea name="desc" placeholder="请输入内容" class="layui-textarea"></textarea>
					    </div>
				  	</div>
					<div class="layui-form-item">
						<label class="layui-form-label">奖品等级</label>
						<div class="layui-input-block">
							<select name="sort">
								<option value="6">请选择奖品等级</option>
								<option value="1">一等奖</option>
								<option value="2">二等奖</option>
								<option value="3">三等奖</option>
								<option value="4">四等奖</option>
								<option value="5">五等奖</option>
								<option value="6">六等奖</option>
							</select>
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-input-block">
							<button class="layui-btn" lay-submit lay-filter="*">添加</button>
							<button type="reset" class="layui-btn layui-btn-primary">重置</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
{/block}
{block name="js"}
<script type="text/javascript" src="/public/static/js/image.zip.js"></script>
<script type="text/javascript" src="/public/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/public/ueditor/ueditor.all.js"></script>

<script>
	var ue = UE.getEditor('content', {
        initialFrameHeight: 450,
		serverUrl: "{:url('admin/ueditor/index?cate=news')}"
	});
	var GV = {
		current_controller: "prize/index"
	};
	layui.use('upload', function() {
		var upload = layui.upload,
		jq = layui.jquery;
		upload.render({
			url: '{:url("upload")}',
			elem: '#image',
			ext: 'jpg|png|gif',
			area: ['500', '500px'],
			before: function(input) {
				
			},
			done: function(res) {
				if(res.code==1){
					$("#demo1").attr('src',res.src);
					$("#thumb").val(res.src);
				}
			}
		});
	})
</script>
{/block}